module.exports = app => {
  const DataTypes = app.Sequelize
  const sequelize = app.model
  const attributes = {
    id: {
      type: DataTypes.UUID,
      allowNull: false,
      primaryKey: true,
      defaultValue: DataTypes.UUIDV1,
      comment: '主键 唯一标识'
    },
    commentId: {
      type: DataTypes.STRING(16),
      comment: '评论id',
      field: 'comment_id'
    },
    courseId: {
      type: DataTypes.STRING(32),
      comment: '课程id',
      field: 'course_id'
    },
    faceUrl: {
      type: DataTypes.STRING(255),
      comment: '用户头像',
      field: 'face_url'
    },
    content: {
      type: DataTypes.TEXT,
      comment: '评论内容'
    },
    mark: {
      type: DataTypes.FLOAT,
      comment: '评分'
    },
    agreeCount: {
      type: DataTypes.INTEGER,
      comment: '点赞数量',
      field: 'agree_count'
    },
    userNickname: {
      type: DataTypes.STRING(128),
      comment: '评论人名称',
      field: 'user_nickname'
    },
    createTime: {
      type: DataTypes.DATE,
      comment: '创建日期',
      field: 'create_time'
    },
    createUser: {
      type: DataTypes.UUID,
      comment: '创建用户',
      field: 'create_user'
    },
    lastTime: {
      type: DataTypes.DATE,
      comment: '修改日期',
      field: 'last_time'
    },
    lastUser: {
      type: DataTypes.UUID,
      comment: '修改用户',
      field: 'last_user'
    },
    deleteFlag: {
      type: DataTypes.BOOLEAN,
      comment: '是否删除（1是，0否）',
      field: 'delete_flag',
      allowNull: false,
      defaultValue: false
    }
  }
  const options = {
    tableName: 'mooc_course_comment'
  }
  const CourseComment = sequelize.define('moocCourseComment', attributes, options)
  // CourseComment.associate = function() {
  //   app.model.CourseComment.belongsTo(app.model.Course, { foreignKsy: 'channelId' })
  // }
  return CourseComment
}
